package com.hyts.infodb.zuul.config;

import com.hyts.infodb.zuul.filter.AuthAccessFilter;
import com.hyts.infodb.zuul.locator.CustomRouteLocator;
import com.hyts.infodb.zuul.service.ZuulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * project-name:infodb
 * package-name:com.hyts.infodb.zuul.config
 * author:Libo/Alex
 * create-date:2019-05-22 21:38
 * copyright:libo-hyts-github
 * email:libo2dev@aliyun.com
 * description:此类主要用于:
 */
//@ComponentScan("com.hyts.infodb.zuul")
@EnableZuulProxy
@Configuration
public class ZuulConfiguration {


    @Autowired
    ZuulService zuulService;


    @Autowired
    ZuulProperties zuulProperties;


    @Autowired
    ServerProperties serverProperties;


    @Bean("customRouteLocator")
    public CustomRouteLocator customRouteLocator(){
        CustomRouteLocator customRouteLocator = new CustomRouteLocator("",zuulProperties);
        customRouteLocator.setZuulService(zuulService);
        return customRouteLocator;
    }

    @Bean
    public AuthAccessFilter authAccessFilter(){
        return new AuthAccessFilter();
    }

}
